<!doctype html>
<html lang="en">
  <head>
    <title>国大医学院</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
  </head>
  <body>
<div id="app">
    <nav class="navbar navbar-expand-md  navbar-dark" style="background-color: #0991f3;">
        <a class="navbar-brand" href="#">国大医学院 <img src="https://img0.baidu.com/it/u=4281977285,1094228893&fm=253&fmt=auto&app=138&f=JPEG?w=542&h=500" width="20px" height="20px"></a>
        <div class="collapse navbar-collapse" id="collapsibleNavId">
            <!-- 在这个导航栏中定义每一个选项 -->
            <ul class="navbar-nav mr-auto mt-2 mt-lg-0">
                <!-- 一个选项就是一个li标签 -->
                <li class="nav-item active ml-5">
                    <a class="nav-link" href="#">医院概况 <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item active ml-5">
                    <a class="nav-link" href="#">医学教育</a>
                </li>
                <li class="nav-item active ml-5">
                    <a class="nav-link" href="#">科室分布</a>
                </li>
                <li class="nav-item active ml-5">
                    <a class="nav-link" href="#">优秀校友</a>
                </li>
                <li class="nav-item active ml-5">
                  <a class="nav-link" href="#">学术交流</a>
                </li>
                <li class="nav-item active ml-5">
                <a class="nav-link" href="#">科学研究</a>
                </li>
                <li class="nav-item active ml-5">
                    <a class="nav-link" href="#">党群建设</a>
                </li>
                <!-- 有下拉选项的 -->
                <li class="nav-item dropdown active ml-5">
                    <a class="nav-link dropdown-toggle" href="#" id="dropdownId" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">功能导航</a>
                    <!-- 下拉选项的值 -->
                    <div class="dropdown-menu" aria-labelledby="dropdownId">
                        <a class="dropdown-item" href="#">预约挂号+</a>
                        <a class="dropdown-item" href="#">查找病历+</a>
                        <a class="dropdown-item" href="#">医师介绍+</a>
                        <a class="dropdown-item" href="#">位置查询+</a>
                    </div>
                </li>
            </ul>
            <!-- <form class="form-inline my-2 my-lg-0">
                <input class="form-control mr-sm-2" type="text" placeholder="Search">
                <button class="btn btn-danger my-2 my-sm-0" type="submit">Search</button>
            </form> -->
        </div>
    </nav>
    <!-- 组件2：展板 b4-jum -->
    <div id="carouselExampleControls" class="carousel slide" data-ride="carousel">
        <div class="carousel-inner">
          <div class="carousel-item active">
            <img src="http://www.czfph.com/upload/images/2021/12/c5c7f8e3b1a89d1.jpg" class="d-block   w-100" alt="...">
          </div>
          <div class="carousel-item">
            <img src="http://www.czfph.com/upload/images/2021/12/204f5e5daecaa5e3.jpg" class="d-block w-100" alt="...">
          </div>
          <div class="carousel-item">
            <img src="http://www.czfph.com/upload/images/2021/12/7bf4c39418d13c58.png" class="d-block w-100" alt="...">
          </div>
        </div>
        <a class="carousel-control-prev" href="#carouselExampleControls" role="button" data-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="sr-only">Previous</span>
        </a>
        <a class="carousel-control-next" href="#carouselExampleControls" role="button" data-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="sr-only">Next</span>
        </a>
        <nav class="breadcrumb">
            <span class="breadcrumb-item active">科室导航</span>
            <a class="breadcrumb-item" href="departscheduling.html" v-if="curDepart!=null">{{curDepart}}排班</a>
            <a class="breadcrumb-item" href="main.html" v-else>请选择科室</a>
            <a class="breadcrumb-item" href="patient.html">就诊人管理</a>
            <a class="breadcrumb-item" href="reservationinfo.html">我的预约信息</a>
        </nav>
    </div>
    <div class="row">
    <!--预约信息查看--查看挂号信息  -->
    <div class="col-5 mb-3 ml-5 mr-3" style="border: 1px solid rgb(218, 215, 215); border-radius: 10px;" v-for="(appointment, index) in allAppointment" :key="index">
        <table   class="table">
            <tbody>
                <tr>
                    <td v-if="appointment.patient!=null">就诊人: {{appointment.patient.name}}</td>
                </tr>
                <tr>
                    <td>就诊科室: {{appointment.doctor.department.title}}</td>
                </tr>
                <tr>
                    <td>预约号: {{appointment.num}}</td>
                </tr>
                <tr>
                    <td>就诊时间: {{appointment.time}}</td>
                </tr>
                <tr>
                    <td>医生姓名: {{appointment.doctor.name}}</td>
                </tr>
                <tr>
                    <td>诊费:  {{appointment.clinic.title}}---{{appointment.clinic.fees}}</td>
                </tr>
                <tr>
                    <td>
                        <button @click="deleteAppoint(appointment.id)" type="button" class="btn btn-danger btn-lg btn-block">取消预约</button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
    <!-- 页脚&网址地图 -->
    <div class="jumbotron jumbotron-fluid mb-0 mt-5 py-3">
        <div class="container">
            <p class="lead text-center">国大医学院@2022</p>
        </div>
    </div>
</div>
    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script> 
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>
<script>
      var url = `http://8.130.108.224:9090`;
    new Vue({
        el:"#app",
        data() {
            return {
                allAppointment:[],
                depart:null
            }
        },
        mounted() {
            this.depart = JSON.parse(sessionStorage.getItem("curDepart"));
            this.getAllAppoint();
            this.deleteAppoint();
        },
        methods: {
            getAllAppoint(){
                axios.get(`${url}/api/appoint`)                                
                .then( (response)=> {
                    this.allAppointment = response.data;
                })
                .catch(function (error) {
                })
            },
            deleteAppoint(id){
                axios.delete(`${url}/api/appoint/${id}`)
                .then( (response)=> {
                    alert("取消成功！");
                    location.href="reservationinfo.html"
                })
                .catch(function (error) {
                })
            },
        },
    })
</script>